/*****************************************************************************
Copyright 2006 Kervin L. Pierre
    EMAIL: otlkcon@adevsoft.com

This file is part of Otlkcon.

Otlkcon is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

Otlkcon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lesser GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License
along with Otlkcon; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*******************************************************************************/

#pragma once
#include "StdAfx.h"
#include "O_IProp.h"
#include "O_IMsgStore.h"

#include <list>

using namespace std;

class O_IMSProvider : public IMSProvider
{
public:
	MAPI_IUNKNOWN_METHODS(IMPL);
    MAPI_IMSPROVIDER_METHODS(IMPL);

    O_IMSProvider(void);
    ~O_IMSProvider(void);

    void Create(otlkcon_memory *m);
    void Destroy();

    HINSTANCE hInstance;

	BOOL IsSpoolerContext();
	O_IMSPMsgStore *RetrieveStore();
	void RemoveLoggedStore(O_IMSPMsgStore* lpStore);
	void AddLoggedStore(O_IMSPMsgStore* lpStore);
private:
    ULONG				cRef;
	sqlite3 *			databaseHandle;
	CRITICAL_SECTION	objectCS;
    otlkcon_memory *	memObj;
	BOOL				m_bSpoolerContext;

	//List of stores should be local for every provider object
	vector<O_IMSPMsgStore *> stores;
};
